"use strict";
cc._RF.push(module, '22538103GxJeqGxAVpSgUft', 'small_role_item');
// scripts/small_role_item.js

"use strict";

var e = require;
var t = module;
var o = exports;

var _ii,
    nn = void 0 && (void 0).__extends || (_ii = function ii(t, e) {
  return (_ii = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _ii(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    rr = void 0 && (void 0).__awaiter || function (t, e, o, i) {
  return new (o || (o = Promise))(function (n, a) {
    function r(t) {
      try {
        l(i.next(t));
      } catch (e) {
        a(e);
      }
    }

    function s(t) {
      try {
        l(i["throw"](t));
      } catch (e) {
        a(e);
      }
    }

    function l(t) {
      var e;
      t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
        t(e);
      })).then(r, s);
    }

    l((i = i.apply(t, e || [])).next());
  });
};

var oo = void 0 && (void 0).__decorate || function (e, t, a, n) {
  var i,
      o = arguments.length,
      s = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, a) : n;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);else for (var r = e.length - 1; r >= 0; r--) {
    (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
  }
  return o > 3 && s && Object.defineProperty(t, a, s), s;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var a = e("BaseModuleUI"),
    n = e("NotifyEventType"),
    i = e("GlobalParams"),
    r = e("AssetsManager"),
    s = e("RoleSoldierInfo"),
    l = cc._decorator,
    _ = l.ccclass,
    c = l.property,
    d = function (e) {
  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    return t.red_bg = null, t.blue_bg = null, t.green_bg = null, t.head_sprite = null, t.head_index = 0, t;
  }

  return nn(t, e), t.prototype.addEvent = function () {
    this.attachEvent(n["default"].SEND_ROLE_SMALL_HEAD_POS, this.showRoleHeadPos, this), this.attachEvent(n["default"].SEND_ROLE_BE_KILL_INFO, this.showRoleBeKill, this);
  }, t.prototype.showHeadInfo = function (e) {
    this.head_index = e, this.red_bg.active = e % 2 != i.GlobalParams.MatchMyIndex % 2, this.blue_bg.active = e % 2 == i.GlobalParams.MatchMyIndex % 2, this.green_bg.active = e == i.GlobalParams.MatchMyIndex;
    var t = i.GlobalParams.MatchGamePlayer[e];
    this.head_sprite.spriteFrame = r["default"].getInstance().getHeroHeadFrame("hero_" + s["default"].Role_info[t.role_id].id);
  }, t.prototype.showRoleHeadPos = function (e, t) {
    var o = t;

    if (o.index == this.head_index) {
      this.node.opacity = 255;
      var a = o.pos;
      (a = cc.v2(a.x / 35, a.y / 35)).y += 10, this.node.setPosition(a);
    }
  }, t.prototype.showRoleBeKill = function (e, t) {
    t.be_kill == this.head_index && (this.node.opacity = 0);
  }, oo([c(cc.Node)], t.prototype, "red_bg", void 0), oo([c(cc.Node)], t.prototype, "blue_bg", void 0), oo([c(cc.Node)], t.prototype, "green_bg", void 0), oo([c(cc.Sprite)], t.prototype, "head_sprite", void 0), oo([_], t);
}(a["default"]);

o["default"] = d;

cc._RF.pop();